Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Feb 7, 2026

Summary

Renames the search_and_replace tool to edit with a new flat parameter structure (file_path, old_string, new_string, replace_all), replacing the old batch operations array. Keeps search_and_replace as a backward-compatible alias so models like MiniMax that reference it in includedTools continue to work without changes.

Changes

  • New edit tool definition (src/core/prompts/tools/native-tools/edit.ts) with file_path, old_string, new_string, replace_all parameters
  • New EditTool execution handler (src/core/tools/EditTool.ts) with replace_all support and uniqueness checking
  • Alias system: Added search_and_replace: "edit" to TOOL_ALIASES — models with includedTools: ["search_and_replace"] (e.g., MiniMax) get the edit tool renamed as search_and_replace
  • Parser updates: NativeToolCallParser.ts handles both "edit" and "search_and_replace" tool names with the new parameter structure
  • Execution routing: presentAssistantMessage.ts routes both tool names to EditTool
  • Alias resolution in validation: isToolAllowedForMode now resolves aliases when checking customTools, ensuring search_and_replace in includedTools correctly maps to edit
  • Backward compat wrapper: SearchAndReplaceTool.ts reduced to a 2-line re-export from EditTool
  • Types: Added "edit" to toolNames, "replace_all" to toolParamNames, updated NativeToolArgs
  • Tests: 16 new EditTool tests covering basic replacement, replace_all, uniqueness errors, no-match errors, approval flow

Test Results

  • 7 targeted test files: 105/105 passing
  • Full src/ suite: 341 passed (29 pre-existing failures from missing @ai-sdk/amazon-bedrock — unrelated)
  • packages/types: 170/170 passing

Important

Renames search_and_replace tool to edit, updates parameters, maintains backward compatibility, and unifies edit-related UI.

  • Behavior:
    • Renames search_and_replace tool to edit with new parameters: file_path, old_string, new_string, replace_all.
    • Keeps search_and_replace as an alias for backward compatibility.
    • Unifies UI for edit-related tools in ChatRow.tsx.
  • Code Changes:
    • Adds edit.ts for new tool definition.
    • Updates EditTool.ts to handle new parameters and logic.
    • Removes search_and_replace.ts, re-exporting EditTool as SearchAndReplaceTool.
    • Updates validateToolUse.ts to resolve tool aliases.
  • Tests:
    • Adds tests for EditTool in editTool.spec.ts.
    • Updates ChatRow.diff-actions.spec.tsx to test unified UI behavior.
    • Removes old searchAndReplaceTool.spec.ts tests, keeping alias verification.

This description was created by Ellipsis for 6b7b715. You can customize this summary. It will automatically update as commits are pushed.


Additional updates in latest commits

  • Unified chat UI treatment for edit-family tool events so searchAndReplace, search_and_replace, search_replace, edit, edit_file, apply_patch, and related edit-result events render through the same appliedDiff branch.
  • Fixed apply_patch partial preview payloads to emit a deterministic non-empty path, eliminating blank initial approval rows and aligning early UX with apply_diff.
  • Added regression tests for apply_patch partial path extraction and unified chat diff-actions rendering.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request labels Feb 7, 2026
@roomote
Copy link
Contributor

roomote bot commented Feb 7, 2026

Rooviewer Clock   See task

All previously flagged issues are now resolved. No new issues in latest commit.

  • Delete orphaned src/core/prompts/tools/native-tools/search_and_replace.ts (old parameter schema, no longer imported)
  • containsXmlToolMarkup false-positive risk: "edit" in the tool-name list matches <editor>, <editable>, etc. after lowercasing -- fixed with hasTagReference boundary checking
  • Unified edit-family branch in ChatRow.tsx drops the onJumpToFile prop that newFileCreated previously passed to CodeAccordian -- fixed with onJumpToCreatedFile memo
  • EditTool.ts: String.prototype.replace() interprets special $-patterns ($$, $&, $`, $') in the replacement string -- fixed with function replacer () => normalizedNew
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph force-pushed the feat/rename-search-and-replace-to-edit branch from 01335c6 to 0a1377c Compare February 8, 2026 00:32
@hannesrudolph hannesrudolph force-pushed the feat/rename-search-and-replace-to-edit branch from 52ad6f3 to 285a161 Compare February 8, 2026 03:44
@hannesrudolph hannesrudolph changed the title feat: rename search_and_replace tool to edit with new parameter structure feat: rename search_and_replace tool to edit and unify edit-family UI Feb 9, 2026
…ture

- Add new 'edit' tool with file_path, old_string, new_string, replace_all params
- Keep search_and_replace as backward-compatible alias via TOOL_ALIASES
- Create EditTool execution handler with replace_all and uniqueness checking
- Update NativeToolCallParser for both edit and search_and_replace names
- Update presentAssistantMessage routing for both tool names
- Add alias resolution to isToolAllowedForMode for customTools validation
- Reduce SearchAndReplaceTool.ts to re-export wrapper from EditTool
- Add 16 new EditTool tests, update searchAndReplaceTool tests
- MiniMax includedTools: ['search_and_replace'] continues to work via alias
- route edit/search/patch-related tool events through the appliedDiff chat UI branch

- ensure apply_patch partial rows emit a deterministic non-empty path

- add apply_patch partial regression tests

- expand ChatRow diff-actions tests for unified behavior
@hannesrudolph hannesrudolph force-pushed the feat/rename-search-and-replace-to-edit branch from 09a6b8a to 793be28 Compare February 10, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant